#pragma once

#include "EquippableItem.h"

class Weapon : public EquippableItem {
protected:
	WeaponFamily m_family;
	GripType m_gripType;
	bool m_highQuality;
	int m_numDice;
	int m_diceSides;
	int m_attackBonus;
	int m_accuracy;
	int m_speed;
	int m_defaultAttackBonus;
	int m_defaultNumDice;
	int m_defaultDiceSides;
	int m_defaultAccuracy;
	int m_defaultSpeed;
	int getRandomDiceDamage() const;
public:
	Weapon(GenericType type, bool highQuality = false);
	Weapon(GenericType type, std::ifstream& file);
	~Weapon();
	virtual void render(float x, float y) = 0;
	virtual void logDetails(TextLog& log) const;
	virtual int getRandomDamage() const;
	GripType getGripType() const;
	virtual int getAccuracy() const;
	virtual int getSpeed() const;
	bool isHighQuality() const;
	std::string getItemName(int mod = 0) const = 0;
	void save(std::ofstream& file) const;
	static bool isWeapon(Item* i);
};

inline GripType Weapon::getGripType() const {return m_gripType;}
inline int Weapon::getAccuracy() const {return m_accuracy;}
inline int Weapon::getSpeed() const {return m_speed;}
inline bool Weapon::isHighQuality() const {return m_highQuality;}
inline bool Weapon::isWeapon(Item* i) {return i->getType(TH_WEAPON_FAMILY) != -1;}
